using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using DTO;
using BUS;
using Utility;

namespace BUS
{
   public  class ThongTinDuLich_BUS
    {
       public static void Insert(ThongTinDuLich_DTO ThongTinDuLich)
        {
            ThongTinDuLich_DAL dulich_DAL = new ThongTinDuLich_DAL();
            dulich_DAL.Insert(ThongTinDuLich);
        }
       public static void Update(ThongTinDuLich_DTO ThongTinDuLich)
        {
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            DuLich_DAL.Update(ThongTinDuLich);
        }
        public static void Delete(int iD)
        {
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            DuLich_DAL.Delete(iD);
        }
       public static ThongTinDuLichCollection Get(string where,
            int pageindex,
            int pagesize,
            string orderby,
            string orderdirection,
            out int total)
        {
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            return DuLich_DAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
       public static ThongTinDuLichCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            return DuLich_DAL.Get(cri.Criter, 0, 0, ThongTinDuLichColumns.MaTuyen.ToString(), OrderDirection.ASC.ToString(), out total);
        }
       public static ThongTinDuLich_DTO GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, ThongTinDuLichColumns.MaTuyen.ToString(), Condition.EQUAL, iD);
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            ThongTinDuLichCollection DuLichCollection = DuLich_DAL.Get(cri.Criter,
                0, 0, ThongTinDuLichColumns.MaTuyen.ToString(), OrderDirection.ASC.ToString(), out total);
            if (DuLichCollection.Count > 0)
                return DuLichCollection[0];
            return null;
        }
       public static ThongTinDuLichCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            ThongTinDuLich_DAL DuLich_DAL = new ThongTinDuLich_DAL();
            return DuLich_DAL.Get(cri.Criter, 1, number,
                ThongTinDuLichColumns.MaTuyen .ToString(), OrderDirection.DESC.ToString(), out total);
        }
       public static ThongTinDuLichCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            ThongTinDuLich_DAL DuLichDAL = new ThongTinDuLich_DAL();
            return DuLichDAL.Get(cri.Criter, 1, number,
                ThongTinDuLichColumns.MaTuyen .ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}
